package com.example.design.bilibili.composite;

public abstract class OrganizationComponent {

    private String name;//名字
    private String desc;//说明

    //此处增加默认实现是因为叶子节点不需要实现这个方法
    protected void add(OrganizationComponent organizationComponent){

        //默认实现
        throw new UnsupportedOperationException();
    }

    //此处增加默认实现是因为叶子节点不需要实现这个方法
    protected void remove(OrganizationComponent organizationComponent){

        //默认实现
        throw new UnsupportedOperationException();
    }

    //构造器
    public OrganizationComponent(String name, String desc) {
        super();
        this.name = name;
        this.desc = desc;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    //方法print 做成抽象的，子类都需要实现
    protected abstract void print();
}
